import request from '@/utils/request'

// 分页查询工艺
export function pageGongyiList(params) {
  return request({
    url: `/gyjc/gongyi/list/${params.curPage}/${params.pageSize}`,
    method: 'get'
  })
}

// 查询所有工艺
export function listAll() {
  return request({
    url: '/gyjc/gongyi/listAll',
    method: 'get'
  })
}

// 根据ID查询工艺
export function getGongyiById(id) {
  return request({
    url: `/gyjc/gongyi/select/${id}`,
    method: 'get'
  })
}

// 修改工序信息
export function updateGongyi(params) {
  return request({
    url: '/gyjc/gongyi/update',
    method: 'post',
    data: params
  })
}

// 新增工序
export function addGongyi(params) {
  return request({
    url: '/gyjc/gongyi/add',
    method: 'post',
    data: params
  })
}

// 删除工序
export function deleteGongyiById(id) {
  return request({
    url: `/gyjc/gongyi/delete/${id}`,
    method: 'delete'
  })
}

// 为工艺添加工序
export function saveRefGyGx(params) {
  return request({
    url: '/gyjc/ref_gy_gx/add',
    method: 'post',
    data: params
  })
}

// 删除工艺中的工序
export function deleteGongyiByGongxu(params) {
  return request({
    url: '/gyjc/ref_gy_gx/delete',
    method: 'post',
    data: params
  })
}
